package org.apache.jsp.ForumHtml;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.rmi.RemoteException;
import java.util.Date;
import com.sun.corba.se.impl.javax.rmi.CORBA.Util;
import javax.xml.ws.Response;
import com.sun.corba.se.spi.protocol.RequestDispatcherDefault;
import exception.NotRegisteredException;
import java.rmi.Naming;
import server.ForumHandlerInt;
import java.sql.*;

public final class loggin_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.List<java.lang.String> _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.List<java.lang.String> getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
  }

  public void _jspDestroy() {
  }

  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
        throws java.io.IOException, javax.servlet.ServletException {

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=utf-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n");
      out.write("\r\n");
      out.write("<!-- initialize class parameters -->\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");
      out.write("<head>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<!-- script for validating forms fields are all filled -->\r\n");
      out.write("<script type=\"text/javascript\">\r\n");
      out.write("function validate_form ( )\r\n");
      out.write("{\r\n");
      out.write("    valid = true;\r\n");
      out.write("\r\n");
      out.write("    if ( document.loginForm.userName.value == \"\" )\r\n");
      out.write("    {\r\n");
      out.write("        alert ( \"Please fill in the 'user_name' box.\" );\r\n");
      out.write("        valid = false;\r\n");
      out.write("        return valid;\r\n");
      out.write("    }\r\n");
      out.write("    \r\n");
      out.write("    \r\n");
      out.write("    if ( document.loginForm.password.value == \"\" )\r\n");
      out.write("    {\r\n");
      out.write("        alert ( \"Please fill in the 'password' box.\" );\r\n");
      out.write("        valid = false;\r\n");
      out.write("        return valid;\r\n");
      out.write("    }\r\n");
      out.write("    \r\n");
      out.write("    var result = eval(loadXMLDoc());\r\n");
      out.write("    //alert(\"|\"+result+\"|\");\r\n");
      out.write("    //alert(\"|ok|\");\r\n");
      out.write("    if(result != \"ok\")\r\n");
      out.write("    {\r\n");
      out.write("    \t//alert(\"aaaa\");\r\n");
      out.write("    \tdocument.getElementById(\"myDiv\").innerHTML=\"<h2>\"+result+\"</h2>\";\r\n");
      out.write("    \treturn false;\r\n");
      out.write("    }\r\n");
      out.write("    \r\n");
      out.write("  //  alert(result);\r\n");
      out.write("   //  alert(flag);\r\n");
      out.write("    \r\n");
      out.write("  \r\n");
      out.write("    return valid;\r\n");
      out.write("}\r\n");
      out.write("</script>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n");
      out.write("<title>Untitled Document</title>\r\n");
      out.write("<link href=\"screenStyle.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body id=\"body\">\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t<script type=\"text/javascript\">\r\n");
      out.write("function loadXMLDoc()\r\n");
      out.write("{\r\n");
      out.write("\t\r\n");
      out.write("var xmlhttp;\r\n");
      out.write("var params;\r\n");
      out.write("params = \"userName=\"+document.loginForm.userName.value+\"&password=\"+document.loginForm.password.value;\r\n");
      out.write("if (window.XMLHttpRequest)\r\n");
      out.write("  {// code for IE7+, Firefox, Chrome, Opera, Safari\r\n");
      out.write("  xmlhttp=new XMLHttpRequest();\r\n");
      out.write("  }\r\n");
      out.write("else\r\n");
      out.write("  {// code for IE6, IE5\r\n");
      out.write("  xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\r\n");
      out.write("  }\r\n");
      out.write("/*xmlhttp.onreadystatechange=function()\r\n");
      out.write("  {\r\n");
      out.write("  if (xmlhttp.readyState==4 && xmlhttp.status==200)\r\n");
      out.write("    {\r\n");
      out.write("\t    \r\n");
      out.write("    document.getElementById(\"myDiv\").innerHTML=xmlhttp.responseText;\r\n");
      out.write("\r\n");
      out.write("    }\r\n");
      out.write("  }\r\n");
      out.write("*/\r\n");
      out.write("  \r\n");
      out.write("xmlhttp.open(\"POST\",\"userValidation.jsp\",false);\r\n");
      out.write("//http.open(\"POST\", \"userValidation.jsp\", true);\r\n");
      out.write("\r\n");
      out.write("//Send the proper header information along with the request\r\n");
      out.write("xmlhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n");
      out.write("xmlhttp.setRequestHeader(\"Content-length\", params.length);\r\n");
      out.write("xmlhttp.setRequestHeader(\"Connection\", \"close\");\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("xmlhttp.send(params);\r\n");
      out.write("return xmlhttp.responseText;\r\n");
      out.write("}\r\n");
      out.write("</script>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t<h1>LOGGIN SCREEN</h1>\r\n");
      out.write("\t<div id=\"myDiv\"></div>\r\n");
      out.write("\r\n");
      out.write("\t\r\n");
      out.write("\t<form action=\"frames.jsp\" method=\"post\" name=\"loginForm\"\r\n");
      out.write("\t\tonsubmit=\"return validate_form ( );\">\r\n");
      out.write("\t\t\t\t<table width=\"200\" border=\"0\">\r\n");
      out.write("\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t\t<th scope=\"row\">username</th>\r\n");
      out.write("\t\t\t\t\t\t<td><input name=\"userName\" type=\"text\" value=\"\" />\r\n");
      out.write("\t\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t\t</tr>\r\n");
      out.write("\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t\t<th scope=\"row\">password</th>\r\n");
      out.write("\t\t\t\t\t\t<td><input name=\"password\" type=\"password\" value=\"\" />\r\n");
      out.write("\t\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t\t</tr>\r\n");
      out.write("\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t</table>\r\n");
      out.write("\t\t\t\t<input name=\"login\" type=\"submit\" value=\"login\" /> <input\r\n");
      out.write("\t\t\t\t\tname=\"cancle\" type=\"button\" value=\"cancle\"\r\n");
      out.write("\t\t\t\t\tonclick=\"window.open('index.jsp', '_self')\" />\r\n");
      out.write("\t\t\t</form>\r\n");
      out.write("</body>\r\n");
      out.write("\r\n");
      out.write("</html>");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
